#include<bits/stdc++.h> 
using namespace std;
const int N = 1010;
const int INF = 0x3f3f3f3f;
int n, b;
int p[N], s[N], sm[N];
int q[N], backup[N];
int ans;
int m;
int main()
{
    cin >> n >> b;
    memset(sm, 0x3f, sizeof sm);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i] >> s[i];
        sm[i] = p[i] + s[i];
    }
    for (int i = 0; i < n; i++)
    {
        int tmp = b;
        int cnt = 0;
        memcpy(backup, sm, sizeof sm);
        backup[i] = backup[i] - p[i] + p[i] / 2;
        sort(backup, backup + n);
        for (int j = 0; j < n; j++)
        {
            tmp -= backup[j];
            if (tmp >= 0) cnt++;
            else break;
        }
        ans = max(ans, cnt);
    }
    cout << ans;
    return 0;
}